# -- coding: utf-8 --


import base64

class Base64_encodeANDdecode_cls:

    def Data_conversion_func(self, type, data):
        # 通过反射机制进行转码 type传入 b64encode --加密  b64decode --解密
        data = getattr(base64, type)(data)
        return data


B64 = Base64_encodeANDdecode_cls()
if __name__ == '__main__':
    data = 'U2Z0cGNzdl8yMzAhJQ=='
    B64 = Base64_encodeANDdecode_cls()
    data = B64.Data_conversion_func('b64decode', data)
